package com.ibeeking.found.log.rest.controller.v1;

import com.ibeeking.found.log.rest.service.ILogCodeGroupService;
import com.ibeeking.found.log.service.common.query.LogCodeGroupPageQuery;
import com.ibeeking.found.log.service.common.vo.LogCodeGroupVO;
import com.ibeeking.found.log.service.common.vo.LogCodeSimpleVO;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName LogCodeGroupController控制器
 * @Description
 * @Author ibeeking
 * @Date 2021-02-25 17:54
 **/
@RestController
@RequestMapping("/b/logCodeGroup/v1")
public class LogCodeGroupController {

    @Resource
    private ILogCodeGroupService logCodeGroupServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "")
    @PostMapping(value = "/pageList")
    public Page<LogCodeGroupVO> pageList(@RequestBody LogCodeGroupPageQuery logCodeGroupPageQuery) {
        return logCodeGroupServiceImpl.pageList(logCodeGroupPageQuery);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "")
    @PostMapping(value = "/selByGroupId/{groupId}")
    public List<LogCodeSimpleVO> selByGroupId(@PathVariable("groupId") Long groupId) {
        return logCodeGroupServiceImpl.selByGroupId(groupId);
    }

    @Log(logType = OperateLogTypeEnum.DEL, describe = "")
    @GetMapping(value = "/del/{id}")
    public Boolean del(@PathVariable("id") Long id) {
        return logCodeGroupServiceImpl.del(id);
    }
}